#include <iostream>

using namespace std;

typedef long long LL;

const int N = 1e6 + 10, mod = 666623333;

LL phi[N], num[N];

int primes[N], cnt;
bool st[N];

LL l, r;

void init(int x)
{
	//欧拉筛
	for (int i = 2; i <= x; i ++ )
	{
//		phi[i] = num[i] = i;
		if (!st[i]) primes[cnt ++ ] = i;
		for (int j = 0; i * primes[j] <= x; j ++ )
		{
			st[i * primes[j]] = true;
			if (i % primes[j] == 0) break;
		}
	}
	
	for (LL i = l; i <= r; i ++ ) phi[i - l + 1] = num[i - l + 1] = i;
	
}

int main()
{
	cin >> l >> r;
	
	init(N - 1);
	
	for (int i = 0; i < cnt; i ++ )
	{
		int p = primes[i];
		LL start = l;
		
		if (start % p) start = (start / p + 1) * (p);
		
		for (LL j = start; j <= r; j += p)  //利用埃氏筛法的原理筛掉l~r的质因子
		{
			phi[j - l + 1] = phi[j - l + 1] / p * (p - 1);  //欧拉函数的定义
			while (num[j - l + 1] % p == 0) num[j - l + 1] /= p;  //把这种质因子除没
		}
		
	}
	
	
	
	LL res = 0;
	
	for (LL i = l; i <= r; i ++ )
	{
		//存在大于根号r的质因子
		if (num[i - l + 1] > 1) phi[i - l + 1] = phi[i - l + 1] / num[i - l + 1] * (num[i - l + 1] - 1);
		res = (res + (i - phi[i - l + 1]) % mod) % mod;  //  题意
	}
	
	cout << res << endl;
	
	return 0;
}